﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;
using System.Data;

namespace deneme
{
    class ClassShowDataGridView
    {
        SqlConnection con = new SqlConnection(ClassSqlConnection.ConnectionString);
     
        public void loadDataGrid(DataGridView dgw, string sqlQueryString) //datagridimize göstermek için method
        {
            SqlCommand cmd = new SqlCommand();
            DataTable data = null;
            cmd.Connection = null;
            SqlDataAdapter dataAdapter = null;
            dgw.Columns.Clear(); // <-- clear columns
            cmd.CommandText = sqlQueryString;
            cmd.Connection = con;
            data = new DataTable();
            dataAdapter = new SqlDataAdapter(cmd);
            dataAdapter.Fill(data);
            dgw.DataSource = data;
        }
    }
}
